package com.study.example.study.extension.caffeinecache;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

/**
 * 启动后执行
 */
@Slf4j
@Component
public class CaffeineCacheRunner implements CommandLineRunner {

    private final CaffeineCache caffeineCache;

    public CaffeineCacheRunner(CaffeineCache caffeineCache) {
        this.caffeineCache = caffeineCache;
    }

    /**
     * 启动后执行
     *
     * @param args String
     */
    @Override
    public void run(String... args) {
        log.info("启动后执行开始");
        this.caffeineCache.creatCacheTask();
        log.info("启动后执行结束");
    }

}
